package org.chen.concurrent.springbootmybatisconcurrent.controller;

import lombok.extern.slf4j.Slf4j;
import org.chen.concurrent.springbootmybatisconcurrent.domain.Products;
import org.chen.concurrent.springbootmybatisconcurrent.response.R;
import org.chen.concurrent.springbootmybatisconcurrent.response.Ret;
import org.chen.concurrent.springbootmybatisconcurrent.service.ProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("product")
@Slf4j
public class ProductsController {

    @Autowired
    ProductsService productsService;

    @GetMapping("/{id}")
    public Ret queryById(@PathVariable("id") Integer id) {
        Products products = productsService.queryById(id);
        return R.success(products);
    }

}
